package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.StrategyReplyComment;
import cn.wolfcode.trip.base.mapper.StrategyReplyCommentMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.TravelQueryObject;
import cn.wolfcode.trip.base.service.IStrategyReplyCommentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StrategyReplyCommentImpl implements IStrategyReplyCommentService {
    @Autowired
    private StrategyReplyCommentMapper replyCommentMapper;


    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<StrategyReplyComment> list = replyCommentMapper.selectForList(qo);
        return new PageInfo<>(list);
    }

    @Override
    public void save(StrategyReplyComment replyComment) {
        replyCommentMapper.insert(replyComment);
    }

    @Override
    public PageInfo selectForCommentMine(TravelQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<StrategyReplyComment> list = replyCommentMapper.selectForCommentMine(qo);
        return new PageInfo<>(list);
    }

}
